var laypage = layui.laypage;
var form = layui.form;
var data = {
    pagenum: 1,
    pagesize: 2,
    // cate_id:1,
    // state:'已发布'
}
function gtt() {
    $.ajax({
        url: '/my/article/list',
        data: data,
        success: function (res) {
            var html = template('aa', res)
            $("tbody").html(html)
            laypage.render({
                elem: 'page',
                count: res.total,
                limit: data.pagesize,
                curr: data.pagenum,
                groups: 5,
                jump: function (obj, first) {
                    //obj包含了当前分页的所有参数，比如：
                    // console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                    // console.log(obj.limit); //得到每页显示的条数

                    //首次不执行
                    if (!first) {
                        //do something

                        data.pagenum = obj.curr
                        data.pagesize = obj.limit
                        gtt()
                    }
                }
            })
        }

    })
}
gtt()


// 获取
$.ajax({
    url: "/my/category/list",
    success: function (res) {
        console.log(res);
        var html = template('dd', res)
        $('#select').html(html);
        form.render('select')
    }
})

$("#A").on('submit', function () {
    e.preventDefault()
    var select = $('#select').val()
    var AA = $('#AA').val()
    category ? data.cate_id = category : delete data.cate_id;
    stat ? data.state = state : delete data.state;
    data.pagesize = 1
})